Skip to content

Add files via upload#3

Open
GAS53 wants to merge 1 commit intomainfrom
lesson_2
Open

Add files via upload#3
GAS53 wants to merge 1 commit intomainfrom
lesson_2

Conversation

@GAS53
Copy link
Copy Markdown
Owner

@GAS53 GAS53 commented Mar 26, 2022

No description provided.

Copy link
Copy Markdown

@Akseonov Akseonov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

все отлично, хорошее выполнение домашнего задания.

Comment on lines +26 to +34
function func(a, b){
if (a>=0 && b>=0){
return a - b
}else if (a<0 && b<0) {
return a*b
} else if (a<0 && b>=0 || a>=0 && b<0){
return a+b
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

все хорошо, задача выполнена, просто говорю как можно улучшить читаемость когда)

function func(a, b){
    if (a>=0 && b>=0){
        return a - b
    }

    if (a<0 && b<0) {
        return a*b
    }

    return a+b
}

Comment on lines +89 to +92
case (operation == '+'): return arg1 + arg2
case (operation == '-'): return arg1 - arg2
case (operation == '*'): return arg1 * arg2
case (operation == '/'): return arg1 / arg2
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

тут по заданию нужно было использовать функции из 5 задания
case (operation == '+'): summ(arg1 + arg2)

/*7 Сравнить null и 0. Объяснить результат.*/
console.log(null == 0)
console.log(null === 0)
// null Не является числом и приведение к числу здесь не работает
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

там все чуть сложнее, если интересно, то можете почитать эту статью
https://habr.com/ru/company/ruvds/blog/337732/

Comment on lines +109 to +116
function pow_(val,pow){
if (pow == 1){return val}
else if (pow == 0) {return 1}
if (pow>0) {
return val*pow_(val, pow - 1) }
else if (pow<0){
return 1/val * pow_(val, pow + 1) }
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

тут тоже можно улучшить читабельность

function pow_(val,pow){
    if (pow == 1) {
        return val
    }
    if (pow == 0) {
        return 1
    }
    if (pow>0) {
        return val*pow_(val, pow - 1)
    }
    if (pow<0) {
        return 1/val * pow_(val, pow + 1)
    }
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

молодец, что реализовал еще и функционал для отрицательных значений степени

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants